home *** CD-ROM | disk | FTP | other *** search
- SUM(3I) Last changed: 1-6-98
-
-
- NNAAMMEE
- SSUUMM - Sums array elements
-
- SSYYNNOOPPSSIISS
- SSUUMM (([AARRRRAAYY==]_a_r_r_a_y [,,[DDIIMM==]_d_i_m] [,,[MMAASSKK==]_m_a_s_k]))
-
- SSUUMM (([AARRRRAAYY==]_a_r_r_a_y [,,[MMAASSKK==]_m_a_s_k]))
-
- IIMMPPLLEEMMEENNTTAATTIIOONN
- UNICOS, UNICOS/mk, and IRIX systems
-
- SSTTAANNDDAARRDDSS
- Fortran 90
-
- DDEESSCCRRIIPPTTIIOONN
- The SSUUMM intrinsic function sums all the elements of _a_r_r_a_y along
- dimension _d_i_m that correspond to the true elements of _m_a_s_k. It
- accepts the following arguments:
-
- _a_r_r_a_y Must be of type integer, real, or complex. It must not be
- scalar.
-
- _d_i_m Must be scalar and of type integer with a value in the range
- 1 <= _d_i_m <= _n, where _n is the rank of _a_r_r_a_y. The
- corresponding actual argument must not be an optional dummy
- argument. This function does a check on _d_i_m when present.
-
- _m_a_s_k Must be of type logical and must be conformable with _a_r_r_a_y.
-
- SSUUMM is a transformational intrinsic function. The name of this
- intrinsic cannot be passed as an argument.
-
- RREETTUURRNN VVAALLUUEESS
- The result is of the same type and kind type parameter as _a_r_r_a_y. It
- is scalar if _d_i_m is absent or if _a_r_r_a_y has rank one; otherwise, the
- result is an array of rank _n-1 and of shape
- (_d , _d , ..., _d , _d , ..., _d ),
- 1 2 _d_i_m-1 _d_i_m+1 _n
- where (_d , _d , ..., _d )
- 1 2 _n
- is the shape of _a_r_r_a_y.
-
- The result of SSUUMM((_a_r_r_a_y)) has a value equal to the sum of all the
- elements of _a_r_r_a_y. If _a_r_r_a_y has size 0, it has the value 0.
-
- The result of SSUUMM((_a_r_r_a_y,,MMAASSKK==_m_a_s_k)) has a value equal to the sum of the
- elements of _a_r_r_a_y corresponding to the true elements of _m_a_s_k. It has
- the value 0 if there are no true elements.
-
- If _a_r_r_a_y has rank one, SSUUMM((_a_r_r_a_y,,_d_i_m[,,_m_a_s_k])) has a value equal to that
- of SSUUMM((_a_r_r_a_y[,,MMAASSKK==_m_a_s_k])). Otherwise, the value of element
- (_s , _s , ..., _s , _s , ..., _s )
- 1 2 _d_i_m-1 _d_i_m+1 _n
- of SSUUMM((_a_r_r_a_y,,_d_i_m[,,_m_a_s_k])) is equal to
- SSUUMM((_a_r_r_a_y(_s , _s , ..., _s , : , _s , ..., _s )
- 1 2 _d_i_m-1 _d_i_m+1 _n
- [,, MMAASSKK==_m_a_s_k(_s , _s , ..., _s , : , _s , ..., _s )]).
- 1 2 _d_i_m-1 _d_i_m+1 _n
-
- EEXXAAMMPPLLEESS
- Example 1: The value of SSUUMM((((// 11,, 22,, 33 //)))) is 6.
-
- Example 2: SSUUMM((CC,, MMAASSKK== CC ..GGTT.. 00..00)) forms the arithmetic sum of the
- positive elements of CC.
-
- Example 3: Assume that BB is the following array:
-
- | 1 3 5 |
- | 2 4 6 |
-
-
- In this case, the following are true:
-
- * SSUUMM((BB,, DDIIMM == 11)) is [3, 7, 11]
-
- * SSUUMM((BB,, DDIIMM == 22)) is [9, 12]
-
- SSEEEE AALLSSOO
- _I_n_t_r_i_n_s_i_c _P_r_o_c_e_d_u_r_e_s _R_e_f_e_r_e_n_c_e _M_a_n_u_a_l, publication SR-2138, for the
- printed version of this man page.
-
-